#include <iostream>

class Animal
{
public:
    virtual void call() = 0;
};

class Dog : public Animal
{
public:
    void call() override
    {
        std::cout << "Dog: woof" << std::endl;
    }
};

class Cat : public Animal
{
public:
    void call() override
    {
        std::cout << "Cat: meow" << std::endl;
    }
};

class AnimalFactory
{
public:
    std::shared_ptr<Animal> createAnimal(std::string animalType)
    {
        if (animalType == "dog")
        {
            return std::make_shared<Dog>();
        }
        else if (animalType == "cat")
        {
            return std::make_shared<Cat>();
        }
        else
        {
            return nullptr;
        }
    }
};

int main()
{
    AnimalFactory factory;
    auto dog = factory.createAnimal("dog");
    auto cat = factory.createAnimal("cat");
    dog->call();
    cat->call();
    return 0;
}